//----------------------------------------------------------------------------------
// CSnakeProcess class
// Author: Oscar Serrano
//
// Description: 20/11/12
// Proceso propio del videojuego, hereta de la classe abstarcta CProcess.
// Contiene la informacion propia del juego, independiente del motor
// Testeig d'input i render 2d
//----------------------------------------------------------------------------------


#pragma once
#ifndef VIDEOGAME_PROCESS_H
#define VIDEOGAME_PROCESS_H

#include "Process/Process.h"
#include "Math\MathTypes.h"
#include "Math\Vector2.h"
#include <vector>



class CRenderManager;
class CFontManager;

typedef enum SNAKE_DIRECTION 
{
	DIRECTION_UP,
	DIRECTION_DOWN,
	DIRECTION_LEFT,
	DIRECTION_RIGHT
};

#define NUM_POINTS 10

class CSnakeProcess: public CProcess
{
public:
	CSnakeProcess						(): m_Position(v2fZERO), m_fAccTimeSpeed(0), m_fAccTimeEnd(0), 
											m_eDirection(DIRECTION_RIGHT), m_iSpeed(3), m_bGameOver(true),
											m_iScore(0) {}
	~CSnakeProcess						();
	void					Init			();
	void					DeInit			();
	void					Update			(float dt);
	void					RenderScene		(CRenderManager* RM);
	void					RenderScene2D	(CRenderManager* RM, CFontManager* FM);


private:
	bool					isTouching		(Vect2f x, Vect2i Point);

private:
	Vect2f					m_Position;
	float					m_fAccTimeSpeed;
	float					m_fAccTimeEnd;
	SNAKE_DIRECTION			m_eDirection;
	int						m_iSpeed;
	bool					m_bGameOver;
	std::vector<Vect2i>		m_vPoints;
	std::vector<bool>		m_bPointActive;
	int						m_iScore;
};

#endif //VIDEOGAME_PROCESS_H

